﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ServicoBase
{
    public class DadosFila
    {
        private static string nomeContainer;

        public static string ObterNomeContainer()
        {
            string nomeFila = System.Configuration.ConfigurationManager.AppSettings["queueResultado"];
            object retorno = MensageriaComum.Mensageria.Receber(nomeFila);

            if (retorno == null)
            {
                if (string.IsNullOrEmpty(nomeContainer))
                {
                    if (string.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings["container"]))
                    {
                        nomeContainer = System.Configuration.ConfigurationManager.AppSettings["containerDefault"];
                    }
                    else 
                    {
                        nomeContainer = System.Configuration.ConfigurationManager.AppSettings["container"];
                    }
                }
            }
            else
            {
                nomeContainer = (string)retorno;
            }

            return nomeContainer;
        }
    }
}
